/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.flypad.main;

import org.flypad.joystick.Joystick;
import org.flypad.joystick.JoystickConstants;
import org.flypad.joystick.JoystickException;

/**
 *
 * @author albus
 */
public class Main implements JoystickConstants {

	public Main(){
		Joystick joystick1 = null; 
	//	Joystick joystick2 = null; 
		try {
			joystick1 = new Joystick();
			//joystick2 = new Joystick("\\\\.\\PPJoyIOCTL2");
			while(true){
				joystick1.digital[3] = Joystick.DIGITAL_ON;
	            joystick1.send();
				//joystick2.digital[4] = Joystick.DIGITAL_ON;
	            //joystick2.send();
	            Thread.sleep(30);
				joystick1.digital[3] = Joystick.DIGITAL_OFF;
	            joystick1.send();
	            Thread.sleep(30);
				//joystick2.digital[4] = Joystick.DIGITAL_OFF;
	            //joystick2.send();
	            //Thread.sleep(500);
			}
		        
			
		} catch (JoystickException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			e.printStackTrace();
		} finally {
            try {
				joystick1.close();
//				joystick2.close();
			} catch (JoystickException e) {
				e.printStackTrace();
			}
        }		
	}
 

	public static void main(String[] args){
		new Main();
	}


}
